package com.meida.app.provider.controller;

import com.meida.common.mybatis.model.*;
import com.meida.common.springmvc.base.BaseController;
import com.meida.module.user.client.entity.AppRole;
import com.meida.module.user.provider.service.AppRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;


/**
 * 用户角色控制器
 *
 * @author flyme
 * @date 2019-06-27
 */
@RestController
@RequestMapping("/role")
@Api(tags = "公共服务")
public class AppRoleController extends BaseController<AppRoleService, AppRole> {

    /**
     * 用户角色分页列表
     * @param pageModel
     * @return
     */
    @ApiIgnore
    @GetMapping(value = "pageList")
    public ResultBody pageList(@ModelAttribute(value = "pageModel") PageModel pageModel) {
        return bizService.pageList(pageModel);
    }

    /**
     * 用户角色列表
     * @param model
     * @return
     */
    @GetMapping(value = "list")
    @ApiOperation(value = "用户角色列表", notes = "用户角色列表 ")
    public ResultBody list(@ModelAttribute(value = "model") ListModel model) {
        return bizService.listEntityMap(model);
    }

    /**
     * 添加用户角色
     * @param model
     * @return
     */
    @ApiIgnore
    @PostMapping(value = "add")
    public ResultBody add(SaveModel model) {
        return bizService.add(model);
    }

    /**
     * 更新用户角色
     * @param model
     * @return
     */
    @ApiIgnore
    @PostMapping(value = "update")
    public ResultBody update(UpdateModel model) {
        return bizService.edit(model);
    }

    /**
     * 删除用户角色
     * @param model
     * @return
     */
    @ApiIgnore
    @PostMapping(value = "remove")
    public ResultBody remove(DeleteModel model) {
        return bizService.delete(model);
    }
}
